//
//  UAStatement.h
//  Unidbaccess
//
//  Created by Toplica Tanasković on 12/14/08.
//  Copyright 2008 HOME. All rights reserved.
//

#import <Cocoa/Cocoa.h>


@interface UAStatement : NSObject {
	void *	nativeStatementData;
}

- (id) initWithStatementData: (void *) aStatementData;
- (void) dealloc;

- (BOOL) execute;

- (BOOL) first;
- (BOOL) previous;
- (BOOL) next;
- (BOOL) last;

- (NSNumber *) affectedRows;

- (NSString *) query;

// Getting values from result set
- (NSNumber *) boolValueAtColumnIndex: (NSUInteger) index;

- (NSNumber *) shortValueAtColumnIndex: (NSUInteger) index;
- (NSNumber *) intValueAtColumnIndex: (NSUInteger) index;
- (NSNumber *) longLongValueAtColumnIndex: (NSUInteger) index;
- (NSNumber *) doubleValueAtColumnIndex: (NSUInteger) index;
- (NSNumber *) unsignedShortValueAtColumnIndex: (NSUInteger) index;
- (NSNumber *) unsignedIntValueAtColumnIndex: (NSUInteger) index;
- (NSNumber *) unsignedLongLongValueAtColumnIndex: (NSUInteger) index;

- (NSString *) stringValueAtColumnIndex: (NSUInteger) index;

- (NSDate *) dateValueAtColumnIndex: (NSUInteger) index;
- (NSDate *) timestampValueAtColumnIndex: (NSUInteger) index;

- (NSNumber *) boolValueAtColumn: (NSString *) columnName;

- (NSNumber *) shortValueAtColumn: (NSString *) columnName;
- (NSNumber *) intValueAtColumn: (NSString *) columnName;
- (NSNumber *) longLongValueAtColumn: (NSString *) columnName;
- (NSNumber *) doubleValueAtColumn: (NSString *) columnName;
- (NSNumber *) unsignedShortValueAtColumn: (NSString *) columnName;
- (NSNumber *) unsignedIntValueAtColumn: (NSString *) columnName;
- (NSNumber *) unsignedLongLongValueAtColumn: (NSString *) columnName;

- (NSString *) stringValueAtColumn: (NSString *) columnName;

- (NSDate *) dateValueAtColumn: (NSString *) columnName;
- (NSDate *) timestampValueAtColumn: (NSString *) columnName;

// Positional data binding
- (BOOL) bindBool: (NSNumber *) value atIndex: (NSUInteger) index;

- (BOOL) bindShort: (NSNumber *) value atIndex: (NSUInteger) index;
- (BOOL) bindInt: (NSNumber *) value atIndex: (NSUInteger) index;
- (BOOL) bindLongLong: (NSNumber *) value atIndex: (NSUInteger) index;
- (BOOL) bindDouble: (NSNumber *) value atIndex: (NSUInteger) index;
- (BOOL) bindUnsignedShort: (NSNumber *) value atIndex: (NSUInteger) index;
- (BOOL) bindUnsignedInt: (NSNumber *) value atIndex: (NSUInteger) index;
- (BOOL) bindUnsignedLongLong: (NSNumber *) value atIndex: (NSUInteger) index;

- (BOOL) bindString: (NSString *) value atIndex: (NSUInteger) index;

- (BOOL) bindDate: (NSDate *) value atIndex: (NSUInteger) index;
- (BOOL) bindTimestamp: (NSDate *) value atIndex: (NSUInteger) index;

// Named data binding
- (BOOL) bindBool: (NSNumber *) value forName: (NSString *) name;

- (BOOL) bindShort: (NSNumber *) value forName: (NSString *) name;
- (BOOL) bindInt: (NSNumber *) value forName: (NSString *) name;
- (BOOL) bindLongLong: (NSNumber *) value forName: (NSString *) name;
- (BOOL) bindDouble: (NSNumber *) value forName: (NSString *) name;
- (BOOL) bindUnsignedShort: (NSNumber *) value forName: (NSString *) name;
- (BOOL) bindUnsignedInt: (NSNumber *) value forName: (NSString *) name;
- (BOOL) bindUnsignedLongLong: (NSNumber *) value forName: (NSString *) name;

- (BOOL) bindString: (NSString *) value forName: (NSString *) name;

- (BOOL) bindDate: (NSDate *) value forName: (NSString *) name;
- (BOOL) bindTimestamp: (NSDate *) value forName: (NSString *) name;

@end
